# Maintainer: Jan Alexander Steffens (heftig) <heftig@archlinux.org>
# Contributor: Jan de Groot <jgc@archlinux.org>

pkgname=gtk-doc
pkgver=1.33.2
pkgrel=3
pkgdesc="Documentation tool for public library API"
url="https://www.gtk.org/gtk-doc/"
arch=(any)
license=(
  FDL
  GPL
)
depends=(
  docbook-xml
  docbook-xsl
  glib2-docs
  python-lxml
  python-pygments
)
makedepends=(
  dblatex
  git
  meson
  yelp-tools
)
checkdepends=(
  bc
  gtk3
  python-parameterized
  python-six
)
optdepends=('dblatex: PDF support')
_commit=14391142ee9d43da116f0f530746ae34cc46930a  # tags/1.33.2^0
source=(
  "git+https://gitlab.gnome.org/GNOME/gtk-doc.git#commit=$_commit"
  0001-Partially-revert-a-gtk-doc-1.31-change-that-broke-e-.patch
  0002-Fix-tests.patch
)
b2sums=('SKIP'
        '82161f0f0860e9b21748b6aadf3dd7017f4541240aa3b0d54bdec74d1b6b8e771a1ab74bc0420899d09b7125361c3fcc2acb15bdf0a3fef8753a08a0992a5eb0'
        'aec43a320f2c687a8c3529eb0b396dcf318b08fec8dcae06d3c2ab0ddeed04e1d324bac158cc15a50ddae768b42a815742a86c24917b295f3c3f6f2d7ad225c7')

pkgver() {
  cd gtk-doc
  git describe --tags | sed 's/GTK_DOC_//;s/_/\./g;s/-/+/g'
}

prepare() {
  cd gtk-doc

  # https://gitlab.gnome.org/GNOME/gtk-doc/-/merge_requests/58
  git apply -3 ../0001-Partially-revert-a-gtk-doc-1.31-change-that-broke-e-.patch

  # test-gobject-mkhtml: ../xml/object.xml:139: element include: XInclude error : could not load ../../examples/gobject.c, and no fallback was found
  git apply -3 ../0002-Fix-tests.patch
}

build() {
  arch-meson gtk-doc build
  meson compile -C build
}

check() {
  meson test -C build --print-errorlogs
}

package() {
  meson install -C build --destdir "$pkgdir"
  python -m compileall -d /usr/lib "$pkgdir/usr/lib"
  python -O -m compileall -d /usr/lib "$pkgdir/usr/lib"
}

# vim:set sw=2 sts=-1 et:
